<template>
	<view>
		<view class="nav-bar">
			<image src="../../../static/back_icon.png" @tap="back" mode=""></image>
			<view class="center">
				忘记密码
			</view>
			<view class="right">
			</view>
		</view>
		<view class="list">
			<view class="list-call">
				<input class="biaoti" v-model="phoneno" maxlength="11" type="number" placeholder-style="color:#CCCCCC"
				 placeholder="请输入手机号码" />
				<view class="yzm" :class="{ yzms: second>0 }" @tap="getcode">{{yanzhengma}}</view>
			</view>
			<view class="list-call">
				<input class="biaoti" v-model="code"  type="number" placeholder-style="color:#CCCCCC"
				 placeholder="验证码" />
			</view>
			<view class="list-call">
				<input class="biaoti" type="text" password v-model="password"  placeholder-style="color:#CCCCCC" placeholder="请输入密码" :password="!showPassword" />
				<image class="img" :src="showPassword?'/static/registration/showed.png':'/static/registration/show.png'" @tap="display"></image>
			</view>
			<view class="list-call">
				<input class="biaoti" type="text" password v-model="password2"  placeholder-style="color:#CCCCCC" placeholder="请输入密码" :password="!showPassword2" />
				<image class="img" :src="showPassword2?'/static/registration/showed.png':'/static/registration/show.png'" @tap="display2"></image>
			</view>
			<view class="list-last">
				5-20个字母、数字以及标点符号（除空格）,字母、数字和标点
				符号至少包含2种
			</view>
		</view>
		<view class="btn" @tap="reset">
			重置密码
		</view>
	</view>
</template>

<script>
	var js;
	export default {
		data() {
			return {
				phoneno: '',
				code: '',
				password: '',
				password2:'',
				second: 0,
				showPassword:false,
				showPassword2:false,
			}
		},
		methods: {
			//导航方法
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
			display() {
			    this.showPassword = !this.showPassword;
			},
			display2() {
			    this.showPassword2 = !this.showPassword2;
			},
			//验证码获取
			getcode() {
				if (this.second > 0) {
					return;
				}
				if (this.phoneno.length != 11) {
					uni.showToast({
						icon: 'none',
						title: '请输入手机号'
					});
					return;
				}
				this.second = 59;
				js = setInterval(() => {
					this.second--;
					if (this.second == 0) {
						clearInterval(js)
					}
				}, 1000)
			},
			//注册请求
			reset(){
				
			}
		},
		computed: {
			yanzhengma() {
				if (this.second == 0) {
					return '获取验证码';
				} else {
					if (this.second < 10) {
						return '重新获取0' + this.second;
					} else {
						return '重新获取' + this.second;
					}
				}
			}
		},
		onUnload() {
			clearInterval(js)
			this.second = 0;
		}
	}
</script>

<style scoped lang="scss">
	.nav-bar {
		height: 128upx;
		padding: 40upx 28upx 0;
		background: #E8271B;
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 750upx;
		z-index: 9;

		image {
			width: 48upx;
			height: 48upx;
		}

		.center {
			font-size: 36upx;
			font-weight: 500;
			line-height: 70upx;
			color: rgba(255, 255, 255, 1);
		}

		.right {
			width: 48upx;
			height: 48upx;
		}
	}

	.list {
		display: flex;
		flex-direction: column;
		padding-left: 58.66upx;
		padding-right: 58.66upx;

		.list-call {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: flex-end;
			padding-bottom: 10upx;
			height: 100upx;
			color: #333333;
			border-bottom: 1upx solid rgba(230, 230, 230, 1);
			.img{
				width: 40upx;
				height: 40upx;
			}
			.biaoti {
				flex: 1;
				text-align: left;
				font-size: 30upx;
				line-height: 100upx;
				margin-left: 16upx;
			}
		}

		.yzm {
			color: #EB4D38;
			font-size: 30upx;
			line-height: 64upx;
			padding-left: 10upx;
			padding-right: 10upx;
			width: auto;
			height: 64upx;
			border-radius: 50upx;
		}

		.yzms {
			color: #EB4D38 !important;
		}
		.list-last{
			margin-top: 10upx;
			font-size:22upx;
			font-weight:500;
			line-height:40upx;
			color:rgba(204,204,204,1);
		}
	}
	.btn{
		text-align: center;
		margin: 60upx auto;
		width:648upx;
		height:108upx;
		background:rgba(232,39,27,1);
		border-radius:54upx;
		font-size:36upx;
		font-weight:500;
		line-height:108upx;
		color:rgba(255,255,255,1);
	}

</style>
